package LeetCode.test;

/**
 * @Description: 删除字符串中的所有指定字符
 * @Date: 2023/3/24 14:59
 * @Author: SALENZ
 * @Version: 1.0
 */
public class DeleteCharString {
    public static String deleteCharString(String sourceString, char...charElements){
        String resultString = sourceString;
        for (char charElement : charElements) {
            StringBuilder stringBuffer = new StringBuilder();
            for (int j = 0; j < resultString.length(); j++) {
                if (resultString.charAt(j) != charElement) {
                    stringBuffer.append(resultString.charAt(j));
                }
            }
            resultString = stringBuffer.toString();
        }
        return resultString;
    }
}
